# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgname=zeratool
pkgver=48.3fb3262
pkgrel=5
pkgdesc='Automatic Exploit Generation (AEG) and remote flag capture for exploitable CTF problems.'
groups=('blackarch' 'blackarch-exploitation' 'blackarch-automation')
arch=('any')
url='https://github.com/ChrisTheCoolHut/Zeratool'
license=('GPL3')
depends=('python' 'python-claripy' 'python-r2pipe' 'ipython' 'python-ropper'
         'angr' 'python-timeout-decorator' 'python-pwntools' 'python-claripy'
         'python-idalink' 'python-tqdm')
makedepends=('git')
source=("$pkgname::git+https://github.com/ChrisTheCoolHut/Zeratool.git")
sha512sums=('SKIP')

pkgver() {
  cd $pkgname

  echo $(git rev-list --count HEAD).$(git rev-parse --short HEAD)
}

build() {
  cd $pkgname

  python setup.py build
}

package() {
  cd $pkgname

  python setup.py install --root="$pkgdir" --prefix=/usr -O1 --skip-build

  install -Dm 644 -t "$pkgdir/usr/share/doc/$pkgname/" README.md

  mv "$pkgdir/usr/bin/zerapwn.py" "$pkgdir/usr/bin/zerapwn"
}

